local AceGUI = LibStub("AceGUI-3.0")
Debug = nil;
AhRuches = LibStub("AceAddon-3.0"):NewAddon("AhRuches", "AceConsole-3.0", "AceHook-3.0");
AhRuches.Forms = 
{
	Main = {},
	Options = {}
};

function AhRuches:OnInitialize()

	self:CreateForms()
	
	self:RegisterChatCommand("ahr", "OnGenericChatCommand")
	
		
	self:Print("AhRuches loaded")
end


function AhRuches:OnEnable()
	

    --self:Hook("AuctionFrameTab_OnClick", true)
end


function AhRuches:AuctionFrameTab_OnClick(sender, index, down)

	print(sender:GetID())
	print(index)
	print(down)

	for v,k in pairs(sender) do
		print(v)
		print(k)
	end
end

function AhRuches:CreateForms()

	local f = AceGUI:Create("Frame")

	f:SetCallback("OnClose", 
		function(widget) 
			AceGUI:Release(widget) 
		end)

	f:SetTitle("AceGUI-3.0 Example")
	f:SetStatusText("Status Bar")
	f:SetLayout("Flow")

	local b = AceGUI:Create("Button")
	b:SetWidth(170)
	b:SetText("Button !")
	b:SetCallback("OnClick", function() print("Click!") end)
	f:AddChild(b)

	AhRuches.Forms["Main"] = f

	f:Hide()

end

function AhRuches:OnGenericChatCommand()
	self:Hook("AuctionFrameTab_OnClick", true)
	--AhRuches.Forms["Main"]:Show()
	self:Print("Received chat command")
end